package ua.simplecoding.kievhome.converter;

import java.util.ArrayList;
import java.util.Collections;
import java.util.List;

/**
 * User: dmytro.fedotov
 * Date: 03.07.11
 */
public abstract class AbstractVOConverter<From, To> implements IVOConverter<From, To> {
    @Override
    public List<To> convert(List<From> fromCollection) {
        if (fromCollection == null || fromCollection.size() == 0) {
            return Collections.emptyList();
        }
        List<To> result = new ArrayList<To>();
        for (From from : fromCollection) {
            result.add(convert(from));
        }
        return result;
    }
}
